package com.uchiha.nova.core.aspect;


import com.uchiha.nova.core.utils.LogTraceUtil;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;

/**
 * @author 周林静
 * @Date 2021-10-26 9:11
 * @Version 1.0
 */
@Aspect
public class LogTraceAspect {

    @Pointcut("@annotation(org.springframework.scheduling.annotation.Async)")
    public void logPointCut() {
    }

    @Around("logPointCut()")
    public Object around(ProceedingJoinPoint point) throws Throwable {
        try {
            LogTraceUtil.insert();
            return point.proceed();
        } finally {
            LogTraceUtil.remove();
        }
    }
}
